<!--
 * @Description: 直播课 -- lesson_live
 * @Author: your name
 * @Date: 2023-12-07
 * @LastEditTime: 2023-12-07
 * @LastEditors: Please set LastEditors
-->

<template>
  <div>
    <div class="lesson_live heart_w">
      <div class="container">
        <div class="course_item">
          <div class="course_title">
            <span>直播课程分类：</span>
          </div>
          <div class="content_list">
            <div
              v-for="(item, index) in liveData"
              :key="item"
              @click="classify(index)"
            >
              <span :class="{ on: index_class == index }">{{ item }}</span>
            </div>
          </div>
        </div>
      </div>

      <!-- 内容区域 -->
      <div class="curriculum_list">
        <div class="recommend heart_w">
          <el-row>
            <el-col :span="6" v-for="item in curriculumLive" :key="item.id">
              <a href="javascript:void(0);" @click="lesson_live">
                <div style="position: relative">
                  <div class="live1">回放</div>
                  <el-image lazy :src="item.image"></el-image>
                </div>
                <div style="padding: 0 15px">
                  <div class="title">直播开始时间:{{ item.time }}</div>
                  <div class="live_teacher">
                    {{ item.title }}
                    <button class="button_global">即将开始</button>
                  </div>
                  <div class="label-count">
                    <div class="actrie">
                      <el-image :src="item.teacher_image"></el-image>
                      融跃名师：{{ item.teacher_name }}
                    </div>
                    <div class="money free">{{ item.free_text }}</div>
                  </div>
                </div>
              </a>
            </el-col>
          </el-row>
        </div>
      </div>

      <el-empty description="暂无数据" v-if="curriculumLive.length <= 0">
      </el-empty>
    </div>
  </div>
</template>

<script>
import { getZhiboList, getZhiboData } from '@/api/lesson_live.js'
export default {
  name: 'lesson_live',
  data() {
    return {
      index_t: 0,
      class_val: false,
      index_class: 0,
      curriculumLive: [],
      liveData: []
    }
  },
  created() {
    console.log(this.$route)
    getZhiboList().then(({ data: data }) => {
      this.liveData = data.data
    })
    this.getLessonData(0)
  },
  methods: {
    getLessonData(idt) {
      getZhiboData({ type_id: idt, page: 1 }).then(({ data: data }) => {
        this.curriculumLive = data.data.list
        console.log(data, 22)
      })
    },
    lesson_live() {
      this.$router.push({ path: '/hot_live', query: {} })
    },
    SecondaryClass(i) {
      this.index_t = i
    },
    classify(index) {
      this.getLessonData(index)
      this.index_class = index
    },
    classifyState() {
      this.class_val = !this.class_val
    }
  }
}
</script>

<style scoped lang="scss">
.on {
  color: #2c8eff;
  font-weight: bold;
}

.autoHeight {
  height: auto !important;
}

.lesson_live {
  margin-top: 30px;
}

.container {
  padding: 10px 20px 0 17px;
  border-radius: 4px;
  background-color: #ffffff;
}
.course_item {
  display: flex;
  align-items: center;

  .course_title {
    font-size: 14px;
    line-height: 60px;
    color: #969696;
  }
}

.content_list {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  height: 60px;
  padding: 15px 103px 0 33px;
  box-sizing: border-box;
  overflow: hidden;
  border-bottom: 1px dashed #efefef;

  div {
    height: 30px;
    margin-right: 30px;
    margin-bottom: 15px;
    line-height: 30px;
    font-size: 15px;
    color: #282828;

    span {
      cursor: pointer;
      user-select: none;
    }
  }
}

.item_morethan {
  height: 30px;
  margin: 15px 0;
  font-size: 14px;
  line-height: 30px;
  color: #282828;
  user-select: none;
  cursor: pointer;
}

.recommend {
  padding-bottom: 30px;
  .el-col {
    margin-bottom: 14px;
    padding: 0 7px;
  }
  .el-col-6 {
    padding: 0 7px;
  }
  .el-row {
    margin-top: 30px;
    a {
      display: block;
      border-radius: 8px;
      background-color: #fff;
      overflow: hidden;
      transition: 0.3s;

      .live1 {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 2;
        padding-right: 16px;
        padding-left: 41px;
        border-bottom-right-radius: 8px;
        background: rgba(0, 0, 0, 0.6) url('/src/assets/images/live1.png') 15px
          center/16px 16px no-repeat;
        font-size: 16px;
        line-height: 34px;
        color: #fff;
      }

      .el-image {
        display: block;
        width: 100%;
        height: 160px;
        // position: relative;

        .type {
          position: absolute;
          right: 7px;
          bottom: 7px;
          z-index: 2;
          width: 20px;
          height: 20px;
          padding: 4px;
          border-radius: 50%;
          background-color: rgba(0, 0, 0, 0.5);
        }
      }
    }
  }

  .el-row a:hover {
    // transform: translateY(-6px);
    box-shadow: 0px 2px 15px rgb(79 109 143 / 15%);
  }

  .label-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    border-top: 1px dashed #eee;
    font-size: 14px;
    color: #999;

    .actrie {
      display: flex;
      align-items: center;
      .el-image {
        width: 40px;
        height: 40px;
        border-radius: 100%;
        margin-right: 5px;
      }
    }

    .money {
      font-size: 14px;
      color: #ff6b00;

      span {
        font-size: 18px;
      }
    }
  }

  .browse-money {
    height: 44px;
    div {
      font-size: 14px;
      color: #666;
      padding: 8px 0;
    }
  }

  .live_teacher {
    color: #262626;
    font-size: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .button_global {
      width: 65px;
      height: 26px;
      background: linear-gradient(-90deg, #fa4e4e, #fd894f);
      border-radius: 13px;
      font-family: PingFang SC;
      font-weight: 400;
      font-size: 12px;
      color: #fff;
      border: none;
      cursor: pointer;
    }
  }
  .title {
    padding-top: 15px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 16px;
    color: #333;
  }
}
</style>
